<!--
 * @Author: ming-yang ming-yang@neusoft.com
 * @Date: 2022-06-15 17:13:40
 * @LastEditors: zhao.dp
 * @LastEditTime: 2022-09-01 17:20:44
 * @FilePath: /gua-dev-admin/src/components/svg-icon.vue
 * @Description:
 * Copyright (c) 2022 by Oscar Young daihl@neusoft.com, All Rights Reserved.
-->
<template>
  <svg :class="svgClass" aria-hidden="true">
    <use :xlink:href="iconName" :fill="color" />
  </svg>
</template>
<script>
import { computed, defineComponent } from 'vue'
export default defineComponent({
  props: {
    iconClass: {
      type: String,
      required: true,
    },
    className: {
      type: String,
      default: '',
    },
    color: {
      type: String,
      default: '',
    },
  },
  setup(props) {
    return {
      iconName: computed(() => `#icon-${props.iconClass}`),
      svgClass: computed(() => {
        if (props.className) {
          return `svg-icon ${props.className}`
        }
        return 'svg-icon'
      }),
    }
  },
})
</script>
<style scoped>
.svg-icon {
  width: 1em;
  height: 1em;
  position: relative;
  fill: currentColor;
  vertical-align: -2px;
}
</style>
